import React, { Component } from 'react';
import { Modal, Steps, Button, Space } from 'antd'
const { Step } = Steps
export default class Negotiate extends Component {
    constructor() {
        super()
        this.state = {
            visible: false,
            dataSource: []
        }
    }
    componentDidMount() {
    }
    handleOk = () => { }
    handleCancel = () => {
        this.setState({
            visible: false
        })
    }
    onFinish = () => { }
    open = () => {
        const { salesId } = this.props
        React.$post('/management/negotiationHistory/queryListByReturnId', { shopOrderDetailId: this.props.shopOrderDetailId }).then(
            (res) => {
                if (res.code === 0) {
                    const data = res.data.map(item => {
                        const content = item.content.split(';')
                        return {
                            title: item.nickName,
                            description: (
                                <div>
                                    {
                                        content.map(ii => {
                                            return <div>{ii}</div>
                                        })
                                    }
                                </div>
                            ),
                            subTitle: item.createTime
                        }
                    })
                    this.setState({
                        dataSource: data,
                        visible: true
                    })
                }

            }
        )
    }
    render() {
        const { visible, dataSource } = this.state
        console.log(dataSource, 'dataSource');
        const formItemLayout = {
            labelCol: {
                span: 6,
            },
            wrapperCol: {
                span: 14,
            },
        };
        return (
            <Modal title="协商历史" visible={visible} onOk={this.handleOk} onCancel={this.handleCancel}>
                <div style={{maxHeight:500,overflowY:'auto'}}>
                {dataSource && dataSource.length > 0 ? <Steps
                    progressDot
                    current={1}
                    direction="vertical"
                >
                    {dataSource.map((v) => {
                        return <Step title={v.title} subTitle={v.subTitle} description={v.description} />
                    })}
                </Steps> : '暂无记录'}
                </div>
            </Modal >
        );
    }
}
